function getPlainText(htmlString) {
  let tempDiv = document.createElement('div')
  tempDiv.innerHTML = htmlString
  return tempDiv.textContent || tempDiv.innerText || '' // 获取纯文本内容
}

export const getSummary = (inputHtml, maxLength) => {
  let plainText = getPlainText(inputHtml)
  if (plainText.length <= maxLength) {
    return plainText // 如果纯文本长度不超过摘要长度，直接返回纯文本
  } else {
    return plainText.substring(0, maxLength) + '...' // 截取纯文本并添加省略号
  }
}
